
import java.io.File;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

import lex.Dump;
import lex.Lexer;
import lex.Token;

public class Main {
	public static void main(String[] args) {
		Lexer lex = new Lexer();
		List<Token> tokens = new LinkedList<Token>();
		try {
			String text = new Scanner(new File(args[0])).useDelimiter("\\Z").next();
			lex.process(text, tokens);
		}
		catch (Throwable e) {
			/* System.err.println(e); */ // assuming only lexing erros which are handled internally
		}
		finally {
			System.out.print(new Dump(tokens).console());
		}
	}
}

